package org.apache.jsp.admin;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.io.*;
import java.util.*;
import beans.BeanLugares;
import utils.GeneradorXML;
import mapping.ElementoMapa;

public final class insertalugar_jsp extends org.apache.jasper.runtime.HttpJspBase
    implements org.apache.jasper.runtime.JspSourceDependent {

  private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory();

  private static java.util.List _jspx_dependants;

  private javax.el.ExpressionFactory _el_expressionfactory;
  private org.apache.AnnotationProcessor _jsp_annotationprocessor;

  public Object getDependants() {
    return _jspx_dependants;
  }

  public void _jspInit() {
    _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
    _jsp_annotationprocessor = (org.apache.AnnotationProcessor) getServletConfig().getServletContext().getAttribute(org.apache.AnnotationProcessor.class.getName());
  }

  public void _jspDestroy() {
  }

  public void _jspService(HttpServletRequest request, HttpServletResponse response)
        throws java.io.IOException, ServletException {

    PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;


    try {
      response.setContentType("text/html; charset=UTF-8");
      pageContext = _jspxFactory.getPageContext(this, request, response,
      			"error/errorpage.jsp", true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write('\n');
      out.write('\n');
      beans.BeanLugares mybean = null;
      synchronized (_jspx_page_context) {
        mybean = (beans.BeanLugares) _jspx_page_context.getAttribute("mybean", PageContext.PAGE_SCOPE);
        if (mybean == null){
          mybean = new beans.BeanLugares();
          _jspx_page_context.setAttribute("mybean", mybean, PageContext.PAGE_SCOPE);
        }
      }
      out.write('\n');

	if(session.getAttribute("usuario") == null){
		throw new IllegalArgumentException("Oye! No intentes acceder a esta pagina sin haberte logueado antes.<br/>"+ 
		"Si ya te logueaste es posible que tu sesion haya expirado; en ese caso, vuelve a introducir tu usuario y contrase&ntilde;a"
		+".<br>Haz click <a href='index.jsp'>aqu&iacute;</a>");
	}
	else {
		if(!session.getAttribute("es_admin").equals(new Integer(1)))
			throw new IllegalArgumentException("Para acceder a esta pagina debes ser administrador.<br/> Volver a la p&aacute;gina de <a href='../index.jsp'>inicio</a>");
	}

      out.write("\n");
      out.write("\n");
      out.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n");
      out.write("<!--  VALIDADO :-D -->\n");
      out.write("<html xmlns=\"http://www.w3.org/1999/xhtml\">\n");
      out.write("<head>\n");
      out.write("\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/>\n");
      out.write("  \t<link rel=\"stylesheet\" href=\"../estilos/style.css\" type=\"text/css\" media=\"screen\" charset=\"utf-8\"/>\n");
      out.write("  \t<link rel=\"stylesheet\" href=\"../estilos/callejerostyle.css\" type=\"text/css\" media=\"screen\" charset=\"utf-8\" />\n");
      out.write("  \n");
      out.write("  \t<script src=\"../ajax/scriptaculous-js-1.8.1/lib/prototype.js\" type=\"text/javascript\" charset=\"utf-8\"></script>\n");
      out.write("\t<script src=\"../ajax/scriptaculous-js-1.8.1/src/effects.js\" type=\"text/javascript\" charset=\"utf-8\"></script>\n");
      out.write(" \t<script src=\"http://www.google.com/jsapi?key=ABQIAAAAW6ZkayH6hhgMyC2y6LQx8xQkRs_WW3LuT_BxsclnnM2SXBs4HxSp2Ukg-tY3gZU6rw7kePxNiNAS9Q\" type=\"text/javascript\"></script>\n");
      out.write("  \t<script src=\"http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAW6ZkayH6hhgMyC2y6LQx8xTlOAjHTmgj9z0QOzdQFV7VnifGuxSJsOzr3eQromRGXbLCHJKjeEnNNw\" type=\"text/javascript\"></script> \n");
      out.write("  \t<script src=\"../js/googlemaps.js\" type=\"text/javascript\" charset=\"utf-8\">\n");
      out.write("  \t</script>\n");
      out.write("  \t<script src=\"../ajax/ajax_lugares.js\" type=\"text/javascript\" charset=\"utf-8\"></script>\n");
      out.write("  \t<script src=\"../ajax/ajax_utils.js\" type=\"text/javascript\" charset=\"utf-8\"></script>\n");
      out.write("  \t<script src=\"../ajax/ajax_login.js\" type=\"text/javascript\" charset=\"utf-8\"></script>\n");
      out.write("\t<script src=\"../js/menu.js\" type=\"text/javascript\" charset=\"utf-8\"></script>\n");
      out.write("\t<title>Erasmus Help! - Nuevo Lugar</title>\n");
      out.write("\t<!--[if IE]> <link href=\"estilos/style_ie.css\" rel=\"stylesheet\" type=\"text/css\"> <![endif]-->\n");
      out.write("\t\n");
      out.write("</head>\n");
      out.write("\n");
      out.write("<body onload=\"ocultaSubMenu(); inicializa();ocultar('form_nuevo_lugar');\" onunload=\"GUnload()\">\n");
      out.write("\t\n");
      out.write("\t");
      org.apache.jasper.runtime.JspRuntimeLibrary.include(request, response, "hidden_admin.jsp", out, false);
      out.write("\n");
      out.write("\t<div id='page_wrapper'>\n");
      out.write("\t");
      org.apache.jasper.runtime.JspRuntimeLibrary.include(request, response, "cabecera_admin.jsp", out, false);
      out.write('\n');
      out.write('	');
      org.apache.jasper.runtime.JspRuntimeLibrary.include(request, response, "menu_admin.jsp", out, false);
      out.write("\n");
      out.write("\t<div id='content_wrapper'>\n");
      out.write("\t<div class='spacer'></div> \n");
      out.write("\t<div id='contenido'>\n");
      out.write("\n");
      out.write("\t<div id=\"cajaformnuevolugar\">\n");
      out.write("\t\t<!--<h2 class=\"titform\">Datos de nuevo lugar favorito</h2>-->\n");
      out.write("\t\t<br/>\n");
      out.write("\t\t<div id = \"capaBusqGmaps\">\n");
      out.write("\t\t\t<form action=\"#\" id=\"busqlugar\" onsubmit=\"showAddress(this.direccion.value, true); return false\">\n");
      out.write("\t\t\t\t<fieldset>\n");
      out.write("\t\t\t\t\t<legend>Buscar:</legend>\n");
      out.write("\t\t\t\t\t<div>\n");
      out.write("\t\t\t\t\t\t<input type=\"text\" id=\"direccion\" name=\"direccion\" size=\"30\" title=\"Introduce lugar o direccion a buscar\"/>\n");
      out.write("\t\t\t\t\t\t<input type=\"submit\" class=\"mybtn\" value=\"Buscar!\" title=\"Pulsa para buscar\"/>\n");
      out.write("\t\t\t\t\t</div>\n");
      out.write("\t\t\t\t\t<div id=\"capaCreaMarcador\" onclick=\"ponerMarcadorNuevoLugarEnCentroMapa()\"><p>Poner marcador</p></div>\n");
      out.write("\t\t\t\t</fieldset>\n");
      out.write("\t\t\t</form>\n");
      out.write("\t\t</div><!-- fin id = \"capaBusqGmaps\" -->\n");
      out.write("\t\t<div class=\"spacer\"></div>\n");
      out.write("\t\t<div id=\"form_nuevo_lugar\">\n");
      out.write("\t\t\t<!-- <h2 class=\"titform\">Datos de nuevo lugar de inter&eacute;s</h2> -->\n");
      out.write("\t\t\t<form action=\"#\" id=\"frmnuevolugar\" method = \"post\" enctype=\"multipart/form-data\" onsubmit=\"return false\">\n");
      out.write("\t\t\t\t<fieldset>\n");
      out.write("\t\t\t\t<legend>Nuevo lugar favorito</legend>\n");
      out.write("\t\t\t\t\n");
      out.write("\t\t\t\t<div class=\"spacer\"></div>\n");
      out.write("\t\t\t\t<div id=\"formlugar\">\n");
      out.write("\t\t\t\t\t<div id=\"itnomlugar\">\n");
      out.write("\t\t\t\t\t\t<label for=\"nomlugar\">Nombre<sup>*</sup></label>\n");
      out.write("\t\t\t\t\t\t<input type=\"text\" maxlength = \"100\" size=\"35\" id=\"nomlugar\" name=\"nomlugar\" title=\"Introduzca el nombre del lugar\"/>\n");
      out.write("\t\t\t\t\t</div>\n");
      out.write("\t\t\t\t\t\t\n");
      out.write("\t\t\t\t\t<div id=\"seltipolugar\">\n");
      out.write("\t\t\t\t\t\t<label for=\"tipo_nuevo_lugar\">Tipo</label>\n");
      out.write("\t\t\t\t\t\t<select id=\"tipo_nuevo_lugar\" name=\"tipo_nuevo_lugar\" size=\"1\" title=\"Selecciona el tipo de lugar\">\n");
      out.write("\t\t\t\t\t\t");
	
						mybean.conectar();
						List listaTipoLugares = mybean.getTipoLugares();
						Iterator it = listaTipoLugares.iterator();			
						while(it.hasNext()){
							String [] valorTipo = ((String) it.next()).split(",");
						
      out.write("\n");
      out.write("\t\t\t\t\t\t\t<option value = \"");
      out.print(valorTipo[0]);
      out.write('"');
      out.write('>');
      out.print(valorTipo[1]);
      out.write("</option>\n");
      out.write("\t\t\t\t\t\t");
}
						mybean.desconectar();
						
      out.write("\n");
      out.write("\t\t\t\t\t\t</select>\n");
      out.write("\t\t\t\t\t</div><!-- fin id = \"seltipolugar\" -->\n");
      out.write("\t\t\t\t\t\n");
      out.write("\t\t\t\t\t<div id=\"itdirecclugar\">\n");
      out.write("\t\t\t\t\t\t<label for=\"direcclugar\">Direcci&oacute;n</label>\n");
      out.write("\t\t\t\t\t\t<input id=\"direcclugar\" name=\"direcclugar\" type=\"text\" maxlength = \"100\" size=\"50\"  title=\"Introduzca la direcci&oacute;n del lugar\"/>\n");
      out.write("\t\t\t\t\t</div>\n");
      out.write("\t\t\t\t\t<div id=\"tadescrlugar\" style=\"float:left\">\n");
      out.write("\t\t\t\t\t\t<label for=\"descrlugar\">Descripci&oacute;n</label>\n");
      out.write("\t\t\t\t\t\t<div id=\"capadescripcionlugar\">\n");
      out.write("\t\t\t\t\t\t\t<textarea id=\"descrlugar\" name=\"descrlugar\" rows=\"4\" cols =\"45\" \n");
      out.write("\t\t\t\t\t\t\tonkeyup=\"contarCaracteres(this, event)\"  title=\"Introduzca la descripci&oacute;n del lugar\"></textarea>\t\t\t\t\t\n");
      out.write("\t\t\t\t\t\t</div>\n");
      out.write("\t\t\t\t\t\t<div id=\"capacontador\">\n");
      out.write("\t\t\t\t\t\t\t<input id=\"contador\" type=\"text\" size=\"4\" readonly=\"readonly\" value=\"255\"/>\n");
      out.write("\t\t\t\t\t\t\t<br/><small>Max. 255 caracteres</small>\n");
      out.write("\t\t\t\t\t\t\t<p id=\"limitechar\"></p>\n");
      out.write("\t\t\t\t\t\t</div>\n");
      out.write("\t\t\t\t\t</div>\t<!-- fin id = \"tadescrlugar\" -->\n");
      out.write("\t\t\t\t</div><!--fin div id=\"formlugar\"-->\n");
      out.write("\t\t\t\t<div id=\"capatfnos\">\n");
      out.write("\t\t\t\t\t<div id=\"formtfnos\">\t\n");
      out.write("\t\t\t\t\t\t<h3>Tel&eacute;fonos</h3>\n");
      out.write("\t\t\t\t\t\t<input type=\"hidden\" id=\"numMaxTfnos\" name=\"numMaxTfnos\" value=\"1\" size=\"2\"/>\n");
      out.write("\t\t\t\t\t\t<input type=\"hidden\" id=\"numActualTfnos\" name=\"numActualTfnos\" value=\"1\" size=\"2\"/>\n");
      out.write("\t\t\t\t\t\t<div id=\"listatfnos\" >\n");
      out.write("\t\t\t\t\t\t\t<div id=\"btntelefonos\">\n");
      out.write("\t\t\t\t\t\t\t\t<button class=\"mybtn\" onmouseover=\"goLite(this)\" onmouseout=\"goDim(this)\" \n");
      out.write("\t\t\t\t\t\t\t\tonclick=\"anadirTfno()\" title=\"A�adir otro telefono\">+</button>\n");
      out.write("\t\t\t\t\t\t\t\t<button id=\"btnborrtfno\" class=\"mybtn\" onmouseover=\"goLite(this)\" onmouseout=\"goDim(this)\"\n");
      out.write("\t\t\t\t\t\t\t\tonclick=\"quitarTfno()\" title=\"Eliminar telefono\">-</button>\n");
      out.write("\t\t\t\t\t\t\t</div><br/>\n");
      out.write("\t\t\t\t\t\t\t<div class=\"divtfno\" id=\"divtfno1\">\n");
      out.write("\t\t\t\t\t\t\t\t<input type=\"hidden\" id=\"idtfno1\" name=\"idtfno1\" value=\"0\" size=\"2\"/>\n");
      out.write("\t\t\t\t\t\t\t\t<input type=\"checkbox\" id=\"tfnochk_1\" name=\"tfnochk_1\" class=\"chkbox\"/>\n");
      out.write("\t\t\t\t\t\t\t\t<input type=\"text\" id=\"tfno1\" name=\"tfno1\" value=\"\" maxlength=\"45\" title=\"Introduzca telefono\"/>\n");
      out.write("\t\t\t\t\t\t\t</div>\n");
      out.write("\t\t\t\t\t\t</div><!--fin div id=\"listatfnos\"-->\n");
      out.write("\t\t\t\t\t</div><!--fin div id=\"formtfnos\"-->\n");
      out.write("\t\t\t\t</div><!--fin div id=\"float:left; width: 100%\"-->\n");
      out.write("\t\t\t\t<div id=\"coordenadas\">\n");
      out.write("\t\t\t\t\t<label>Coordenadas:</label>\n");
      out.write("\t\t\t\t\t<input type=\"text\" id = \"latitud\" name=\"latitud\" readonly=\"readonly\"/>\n");
      out.write("\t\t\t\t\t<input type=\"text\" id = \"longitud\" name=\"longitud\" readonly=\"readonly\"/>\n");
      out.write("\t\t\t\t</div>\n");
      out.write("\t\t\t\t<div class=\"spacer\"></div>\n");
      out.write("\t\n");
      out.write("\t\t\t<div class=\"centrado\">\n");
      out.write("\t\t\t\t<button id=\"btnEnvia\" class=\"mybtn\" onmouseover=\"goLite(this)\" onmouseout=\"goDim(this)\"\n");
      out.write("\t\t\t\ttitle=\"Enviar informacion del nuevo lugar\"\tonclick = \"procesaParametros('res_insert_lugar', 'frmnuevolugar', 'proc_inserta_lugar.jsp', 'post')\">Enviar</button>\n");
      out.write("\t\t\t\t\t\t\t\t\n");
      out.write("\t\t\t\t<button id=\"btnCancelaCreacionLugar\" class=\"mybtn\" onmouseover=\"goLite(this)\" onmouseout=\"goDim(this)\"\n");
      out.write("\t\t\t\ttitle=\"Cancela la creacion de un nuevo lugar\" onclick = \"cancelaCreacionNuevoLugar()\">Cancelar</button>\n");
      out.write("\t\t\t</div>\n");
      out.write("\t\t</fieldset>\n");
      out.write("\t\t</form>\n");
      out.write("\t\t</div><!--fin div  id=\"form_nuevo_lugar\" -->\n");
      out.write("\t\t<div id=\"res_insert_lugar\"></div>\n");
      out.write("\t\t<div id=\"celdaDivMapa\" class=\"mapuser\">\n");
      out.write("\t\t\t<div id=\"map\" style=\"height:400px; width:820px;\"></div>\n");
      out.write("\t\t</div>\n");
      out.write("\t\t<div class=\"spacer\"></div>\n");
      out.write("\t</div>\n");
      out.write("\t\n");
      out.write("\t</div>\n");
      out.write("\t\n");
      out.write("\t</div><!-- fin id='content_wrapper' -->\n");
      out.write("\t");
      org.apache.jasper.runtime.JspRuntimeLibrary.include(request, response, "pie.html", out, false);
      out.write("\n");
      out.write("\t</div><!--  id='page_wrapper' -->\n");
      out.write("</body>\n");
      out.write("</html>\n");
      out.write("\n");
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)){
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          try { out.clearBuffer(); } catch (java.io.IOException e) {}
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
}
